#ifndef PROTREETHREAD_H
#define PROTREETHREAD_H

#include <QThread>
#include <QTreeWidget>

class ProTreeThread : public QThread
{
    Q_OBJECT;
public:
    ProTreeThread(const QString &src_path, const QString &dist_path,
                  QTreeWidgetItem *parent_item, int &file_count,
                  QTreeWidget *self, QTreeWidgetItem *root,QObject *parent = nullptr);
signals:
    void SigUpdateProgress(int count);
    void SigFinishProgress(int count);
protected:
    virtual void run()override;
private:
    void CreateProTree(const QString &src_path, const QString &dist_path,
              QTreeWidgetItem *parent_item, int &file_count,
                       QTreeWidget *self, QTreeWidgetItem *root, QTreeWidgetItem* preItem = nullptr);
    const QString & _src_path;
    const QString & _dist_path;
    QTreeWidgetItem * _parent_item;
    int & _file_count;
    QTreeWidget * _self;
    QTreeWidgetItem * _root;
    bool _bstop;
public slots:
    void SlotCancelProgress();
};

#endif // PROTREETHREAD_H
